import React from 'react'
import './index.less'

// redux
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import * as walletInfoActionsFromOtherFile from '@/store/actions/walletinfo' 
/**
 * 类别：组件
 * 功能：账单按月统计，包括收入，支出两部分
 */
class BillSummary extends React.Component {


    componentDidMount() {
    }
    render() {
        const bill = this.props.bill || {}
        return (
        	<div className="billSummary" className="billSummary" >
                <div className="month">
                    <strong>{bill.month}</strong>
                </div>
                <div className="amount">收入：{bill.income}</div>
                <div className="amount">支出：{bill.pay}</div>
        	</div>
        )
    }

    
}



// -------------------redux react 绑定--------------------

function mapStateToProps(state) {
    return {
        walletinfo: state.walletinfo
    }
}

function mapDispatchToProps(dispatch) {
    return {
        walletinfoActions: bindActionCreators(walletInfoActionsFromOtherFile, dispatch)
    }
}
export default connect(
    mapStateToProps,
    mapDispatchToProps
)(BillSummary)
